<?php
/**
* jiemengarticle.php
*
* Create on 2016-4-18
* Create by TT
*/
namespace haibao\cms\data;

class Jiemengarticle extends \haibao\cms\data\BaseMysql{

	public function __construct(){
		parent::__construct('\haibao\cms\model\data\Jiemengarticle');
	}
	
	public function getCategory(){
		$sql = 'select Id,Name from JieMengCategory where Status=%s and ParentId=%s';
		$data = $this->query($sql,array(1,0));
		$result = array();
		while($data->fetch_assoc()){
			$id = $data->getData('Id');
			$result[$id] = $data->getData('Name');
		}
		return $result;
	}
	
	public function getAllTitle(){
		$sql = 'select Id,CategoryId,Title from JieMengArticle';
		$data = $this->query($sql);
		$result = array();
		while($data->fetch_assoc()){
			$id = $data->getData('Id');
			$cId = $data->getData('CategoryId');
			$result[$cId][$id] = $data->getData('Title');
		}
		return $result;
	}
}